/**
 * 
 * 深圳市店联电子商务有限公司
 * 
 * */
package com.ruipengkj.service.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ruipengkj.bean.TShopJob;
import com.ruipengkj.commons.base.query.PageModel;
import com.ruipengkj.dao.TShopJobDao;
import com.ruipengkj.service.TShopJobService;
/**
 * 说明：
 * 招聘管理Service层接口实现
 * @Author：朱攀
 * @Date：2012-07-25
 */
@Service
public class TShopJobServiceImpl implements TShopJobService{
	@Resource
	private TShopJobDao tShopJobDao;//DAO层
	//查询所有
	@Override
	public List<TShopJob> findService(TShopJob entity) throws Exception {
		String hql = "select o from TShopJob o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return tShopJobDao.findDao(hql, whereHQL.toString(), param, orderby);
	}
	//根据ID翻页查询
	@Override
	public PageModel<TShopJob> getScrollService(int firstResult,
			int maxResult, TShopJob entity) throws Exception {
		String hql = "select o from TShopJob o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return tShopJobDao.getScrollDao(hql, whereHQL.toString(), param, firstResult, maxResult, orderby);
	}

	//修改
	@Override
	public void modifyService(TShopJob entity) throws Exception {
		tShopJobDao.modifyDao(entity);
		
	}
	//添加
	@Override
	public void saveService(TShopJob entity) throws Exception {
		tShopJobDao.saveDao(entity);
	}
	//根据ID删除
	@Override
	public void deleteService(String id) throws Exception {
		tShopJobDao.deleteDao(id);
		
	}
	//根据ID查询
	@Override
	public TShopJob getByIdService(String id) throws Exception {
		return tShopJobDao.getByIdDao(id);
	}
	//添加或修改
	@Override
	public void saveOrUpdateService(TShopJob entity) throws Exception {
		tShopJobDao.saveOrUpdateDao(entity);
	}
	//添加返回ID
	@Override
	public Serializable saveRetService(TShopJob entity) throws Exception {
		return tShopJobDao.saveRetDao(entity);
	}
	public TShopJobDao getTShopJobDao() {
		return tShopJobDao;
	}
	public void setTShopJobDao(TShopJobDao shopJobDao) {
		tShopJobDao = shopJobDao;
	}
	
}